package com.atguigu.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.base.BaseController;
import com.atguigu.entity.Dict;
import com.atguigu.result.Result;
import com.atguigu.service.DictService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 杨林
 * @create 2022-09-22 11:22 星期四
 * description:
 */
@RestController
@RequestMapping("/dict")
public class DictController { //not extends BaseController  因为查询条件已经封装到HouseQueryVo中

    @Reference
    private DictService dictService;

    @RequestMapping("/findListByDictCode/{dictCode}")
    public Result findListByDictCode(@PathVariable String dictCode){

        //获取指定的字典项列表
        List<Dict> areaList = dictService.findListByDictCode(dictCode);

        return Result.ok(areaList);
    }


    @RequestMapping("findListByParentId/{parentId}")
    public Result findListByParentId(@PathVariable Long parentId){
        List<Dict> plateList = dictService.findListByParentId(parentId);
        return Result.ok(plateList);
    }

}
